package net.dotool.geo;

import java.util.HashMap;
import java.util.Map;

public final class EllipsoidDefs {
	public static final Map<Integer, Ellipsoid> table = new HashMap<Integer, Ellipsoid>();

	static {
		// placeholder only, To allow array indices to match id numbers
		EllipsoidDefs.addEllipsoid(new Ellipsoid(-1, "Placeholder", 0, 0));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(1, "Airy", 6377563, 0.00667054));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(2, "Australian National", 6378160, 0.006694542));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(3, "Bessel 1841", 6377397, 0.006674372));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(4, "Bessel 1841 (Nambia) ", 6377484, 0.006674372));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(5, "Clarke 1866", 6378206, 0.006768658));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(6, "Clarke 1880", 6378249, 0.006803511));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(7, "Everest", 6377276, 0.006637847));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(8, "Fischer 1960 (Mercury) ", 6378166, 0.006693422));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(9, "Fischer 1968", 6378150, 0.006693422));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(10, "GRS 1967", 6378160, 0.006694605));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(11, "GRS 1980", 6378137, 0.00669438));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(12, "Helmert 1906", 6378200, 0.006693422));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(13, "Hough", 6378270, 0.00672267));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(14, "International", 6378388, 0.00672267));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(15, "Krassovsky", 6378245, 0.006693422));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(16, "Modified Airy", 6377340, 0.00667054));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(17, "Modified Everest", 6377304, 0.006637847));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(18, "Modified Fischer 1960", 6378155, 0.006693422));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(19, "South American 1969", 6378160, 0.006694542));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(20, "WGS 60", 6378165, 0.006693422));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(21, "WGS 66", 6378145, 0.006694542));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(22, "WGS-72", 6378135, 0.006694318));
		EllipsoidDefs.addEllipsoid(new Ellipsoid(23, "WGS-84", 6378137, 0.00669438));
	}

	public static final void addEllipsoid(final Ellipsoid datum) {
		EllipsoidDefs.table.put(datum.getId(), datum);
	}

	public static final Ellipsoid getEllipsoid(final Integer datum) {
		final Ellipsoid ellipsoid = EllipsoidDefs.table.get(datum);
		if (null == ellipsoid)
			return EllipsoidDefs.table.get(-1);
		return ellipsoid;
	}
}
